﻿Imports System.ComponentModel
Imports PTIC_Util

''' <summary>
''' Contient les informations physiques relatives à un traitement
''' </summary>
''' <remarks></remarks>
Public Class BaseInfoTraitement
    Inherits BaseNotifyPropertyChangeComponentModel
    Implements IInfosTraitement

    Private _Nom As String

    ''' <summary>
    ''' Constructeur
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New(ByVal nom As String)
        _Nom = nom
        _FichierBDD = New Cla_NomFichier
        AddHandler _FichierBDD.NomCompletChanging, AddressOf onFichierBDD_NomCompletChanging
        AddHandler _FichierBDD.NomCompletChanged, AddressOf onFichierBDD_NomCompletChanged
    End Sub

    ''' <summary>
    ''' Identifiant
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property Nom As String Implements IInfosTraitement.nom
        Get
            Return _Nom
        End Get
    End Property

    ''' <summary>
    ''' Nom du fichier associé au traitement
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property FichierBDD As Cla_NomFichier Implements IInfosTraitement.FichierBDD
        Get
            Return _FichierBDD
        End Get
    End Property
    Private _FichierBDD As Cla_NomFichier
    Public Event FichierBDD_NomCompletChanging As PropertyChangeEventHandler(Of String) Implements IInfosTraitement.FichierBDD_NomCompletChanging
    Public Event FichierBDD_NomCompletChanged As PropertyChangeEventHandler(Of String) Implements IInfosTraitement.FichierBDD_NomCompletChanged
    Private Sub onFichierBDD_NomCompletChanging(ByVal sender As Object, ByVal e As PropertyChangeEventArgs(Of String))
        RaiseEvent FichierBDD_NomCompletChanging(sender, e)
    End Sub
    Private Sub onFichierBDD_NomCompletChanged(ByVal sender As Object, ByVal e As PropertyChangeEventArgs(Of String))
        RaiseEvent FichierBDD_NomCompletChanged(sender, e)
    End Sub

    ''' <summary>
    ''' Nom de la table associée au traitement dans la base de données
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property NomTableDansBDD As String Implements IInfosTraitement.NomTableDansBDD
        Get
            Dim e As New PropertyGetEventArgs(Of String)(_NomTableDansBDD, _NomTableDansBDD)
            RaiseEvent NomTableDansBDDGet(Me, e)
            Return e.returnValue
        End Get
        Set(ByVal value As String)
            OnPropertyChanging("NomTableDansBDD")
            Dim e As New PropertyChangeEventArgs(Of String)(NomTableDansBDD, value)
            If e.IsValide Then RaiseEvent NomTableDansBDDChanging(Me, e)
            If e.IsValide Then
                _NomTableDansBDD = e.NewValue
                OnPropertyChanged("NomTableDansBDD")
                RaiseEvent NomTableDansBDDChanged(Me, e)
            End If
        End Set
    End Property
    Private _NomTableDansBDD As String
    Public Event NomTableDansBDDGet As PropertyGetEventHandler(Of String) Implements IInfosTraitement.NomTableDansBDDGet
    Public Event NomTableDansBDDChanging As PropertyChangeEventHandler(Of String) Implements IInfosTraitement.NomTableDansBDDChanging
    Public Event NomTableDansBDDChanged As PropertyChangeEventHandler(Of String) Implements IInfosTraitement.NomTableDansBDDChanged

    ''' <summary>
    ''' Nom temporaire associé au traitement (utile lors des opérations de requêtage)
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property TempNom As String Implements IInfosTraitement.TempNom
        Get
            Dim e As New PropertyGetEventArgs(Of String)(_TempNom, _TempNom)
            RaiseEvent TempNomGet(Me, e)
            Return e.returnValue
        End Get
        Set(ByVal value As String)
            OnPropertyChanging("TempNom")
            Dim e As New PropertyChangeEventArgs(Of String)(TempNom, value)
            If e.IsValide Then RaiseEvent TempNomChanging(Me, e)
            If e.IsValide Then
                _TempNom = e.NewValue
                OnPropertyChanged("TempNom")
                RaiseEvent TempNomChanged(Me, e)
            End If
        End Set
    End Property
    Private _TempNom As String
    Public Event TempNomGet As PropertyGetEventHandler(Of String) Implements IInfosTraitement.TempNomGet
    Public Event TempNomChanging As PropertyChangeEventHandler(Of String) Implements IInfosTraitement.TempNomChanging
    Public Event TempNomChanged As PropertyChangeEventHandler(Of String) Implements IInfosTraitement.TempNomChanged

End Class
